package com.woniu.pay.feign;

import com.alipay.api.AlipayApiException;
import com.woniu.common.entity.Result;
import com.woniu.pay.entity.PayInfo;
import com.woniu.pay.entity.RefundInfo;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient(name = "life-pay", path = "/alipay")
public interface PayFeignClient {

    @PostMapping("/pay")
    @ApiOperation("支付方法")
    public Result pay(@RequestBody PayInfo payInfo) throws AlipayApiException;

    @PostMapping("/check/{outTradeNo}")
    @ApiOperation("根据订单号主动查询支付状态")
    public Result queryStatusByOutTradeNo(@PathVariable(value = "outTradeNo") String outTradeNo);

    @PostMapping("/refund")
    @ApiOperation("支付宝退单")
    public Result refund(@RequestBody RefundInfo refundInfo);
}
